package com.cn.shuangzi.ad.custom;

import android.content.Context;

import com.bytedance.sdk.openadsdk.mediation.bridge.custom.MediationCustomInitLoader;
import com.bytedance.sdk.openadsdk.mediation.custom.MediationCustomInitConfig;
import com.cn.shuangzi.ad.util.ADUtil;
import com.cn.shuangzi.ad.util.ThreadUtils;
import com.kwad.sdk.api.KsAdSDK;
import com.kwad.sdk.api.SdkConfig;

import java.util.Map;

public class KsCustomerConfig extends MediationCustomInitLoader {

    @Override
    public void initializeADN(final Context context, final MediationCustomInitConfig customInitConfig, Map<String, Object> localExtra) {
        if (!isInit()) {
            /**
             * 在子线程中进行初始化
             */
            ThreadUtils.runOnThreadPool(new Runnable() {
                @Override
                public void run() {
                    KsAdSDK.init(context, new SdkConfig.Builder()
                            .appId(customInitConfig.getAppId())
                            .build());
                    callInitSuccess();
                }
            });
        }
    }

    @Override
    public String getBiddingToken(Context context, Map<String, Object> extra) {
        ADUtil.logError("getBiddingToken extra = " + extra);
        return "bidding token";
    }

    @Override
    public String getSdkInfo(Context context, Map<String, Object> extra) {
        ADUtil.logError("快手 getSdkInfo extra = " + extra);
        return "sdk info";
    }

    @Override
    public String getNetworkSdkVersion() {
        return KsAdSDK.getSDKVersion();
    }
}
